package com.summer.freeMarker;

import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Date;
import java.util.HashMap;

import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;

public class Test {

	public static void main(String[] args) throws IOException, TemplateException {
		Configuration config = new Configuration();
		config.setDirectoryForTemplateLoading(new File("ftl/"));
		Template template = config.getTemplate("a.ftl");
		Writer out = new StringWriter();
		HashMap<String,Object> map = new HashMap<>();
		map.put("now", new Date());
		map.put("msg", "hello");
		template.process(map, out);
		System.out.println(out.toString());
	}

}
